Use case: Read and write DMA operations ¶
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
/* Write data to the SRAM memory -------------------- */
HAL_SRAM_Write_DMA(&hsram,
(uint32_t *)(target_address),
data_to_write,
BufferSize
);
/* Read data from the SRAM memory */
HAL_SRAM_Read_DMA(&hsram,
(uint32_t *)(target_address),
data_read,
BufferSize
);
|
/* Write data to memory */
HAL_DMA_StartDirectXfer_IT(&dma_handle,
data_to_write,
(uint32_t *)(target_address),
BufferSize
);
/* Read data from memory */
HAL_DMA_StartDirectXfer_IT(&dma_handle,
(uint32_t *)(target_address),
data_read,
BufferSize
);
|
Key changes ¶
In HAL2, SRAM read/write is done through memory mapping; DMA transfers use direct DMA APIs.
HAL1 uses
HAL_SRAM_Read_DMA()/HAL_SRAM_Write_DMA()while HAL2 usesHAL_DMA_StartDirectXfer_IT().

